package StudyCode.summary.textfile;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ExportsArrayListOfLinesToFile {

	public static void main(String[] args) {
		ArrayList<String> strings = new ArrayList<>();
		for (int i = 0; i < 10; i++) {
			strings.add("www.tah1986.com");
		}
		exportLinesToFile(strings, Paths.get("E:/Copy/test1.txt"));
		System.out.println("将数组行列表(ArrayListList)导出到文件成功");
	}

	public static void exportLinesToFile(ArrayList<String> lines, Path dataFile) {
		try {
			Files.write(dataFile, lines, StandardCharsets.UTF_8);
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
}
